package com.example.config;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @author 贾明祯
 * @ClassName MyMetObjectHandler
 * @Date 2020/8/21 17:37
 * @Introduce 自动填充
 */
@Component
public class MyMetObjectHandler implements MetaObjectHandler {
    @Override
    public void insertFill(MetaObject metaObject) {
        this.setFieldValByName("createDate",new Date(),metaObject);
        this.setFieldValByName("accountState",1,metaObject);
        this.setFieldValByName("is_del",0,metaObject);
    }

    @Override
    public void updateFill(MetaObject metaObject) {

    }
}
